package cn.csc.module.shop.dal.mysql.businessdic;

import java.util.*;

import cn.csc.framework.common.pojo.PageResult;
import cn.csc.framework.mybatis.core.query.LambdaQueryWrapperX;
import cn.csc.framework.mybatis.core.mapper.BaseMapperX;
import cn.csc.module.shop.dal.dataobject.businessdic.ShopBusinessDicDO;
import org.apache.ibatis.annotations.Mapper;
import cn.csc.module.shop.controller.admin.businessdic.vo.*;

/**
 * 企业经营范围字典数据 Mapper
 *
 * @author liuchuang
 */
@Mapper
public interface ShopBusinessDicMapper extends BaseMapperX<ShopBusinessDicDO> {

    default PageResult<ShopBusinessDicDO> selectPage(ShopBusinessDicPageReqVO reqVO) {
        return selectPage(reqVO, new LambdaQueryWrapperX<ShopBusinessDicDO>()
                .eqIfPresent(ShopBusinessDicDO::getLevel, reqVO.getLevel())
                .eqIfPresent(ShopBusinessDicDO::getPid, reqVO.getPid())
                .likeIfPresent(ShopBusinessDicDO::getName, reqVO.getName())
                .eqIfPresent(ShopBusinessDicDO::getSort, reqVO.getSort())
                .eqIfPresent(ShopBusinessDicDO::getPic, reqVO.getPic())
                .betweenIfPresent(ShopBusinessDicDO::getCreateTime, reqVO.getCreateTime())
                .orderByDesc(ShopBusinessDicDO::getId));
    }

    default List<ShopBusinessDicDO> selectList(ShopBusinessDicExportReqVO reqVO) {
        return selectList(new LambdaQueryWrapperX<ShopBusinessDicDO>()
                .eqIfPresent(ShopBusinessDicDO::getLevel, reqVO.getLevel())
                .eqIfPresent(ShopBusinessDicDO::getPid, reqVO.getPid())
                .likeIfPresent(ShopBusinessDicDO::getName, reqVO.getName())
                .eqIfPresent(ShopBusinessDicDO::getSort, reqVO.getSort())
                .eqIfPresent(ShopBusinessDicDO::getPic, reqVO.getPic())
                .betweenIfPresent(ShopBusinessDicDO::getCreateTime, reqVO.getCreateTime())
                .orderByDesc(ShopBusinessDicDO::getId));
    }

}
